package com.chenchao.javainnerclass;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/10 17:11
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javainnerclass.Test1.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 * 实例内部类属于类对象
 * 由于对象不是静态的所以作为对象成员的内部类也不能有static
 */
public class Test1 {
    public static void main(String[] args) {
        Outer outer = new Outer();
        Outer.Inner inner = outer.new Inner();
        //创建实例内部类
        inner.test();
    }
}
class Outer{
    String name="Outer";
    Inner inner = new Inner();
    void gg(){
        Inner inner = new Inner();
    }
class Inner{
        String name="inner";
        void test(){
            String name="局部变量";
            System.out.println(Outer.this.name);
            System.out.println(this.name);
            System.out.println(name);
        }
    }
}